﻿package proy.sgueca.hr.model;


/*
import javax.swing.JOptionPane;

import org.apache.commons.mail.Email;
import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import javax.mail.*;
import com.sun.istack.internal.logging.Logger;
import com.sun.xml.internal.ws.api.message.Message;
*/


public class Correo {
/*	
	Email email;
	
	   
    public Correo() {
    	email=new SimpleEmail();
    	configure();
	}

    private void configure(){
    	System.out.println("entrando");
    	try{    		
	    	email.setHostName("smtp.gmail.com");
	    //	email.setSmtpPort(465);
	    	email.setAuthenticator(new DefaultAuthenticator("rogger.123.2@gmail.com", "95003245"));
	    	email.setDebug(true);
	    	email.setSSLOnConnect(true);
    	}catch(Exception e){
    		e.printStackTrace();
    		System.out.println("abajo el error");
    		System.out.print(e);
    	}    	
    }       
	public boolean enviarMail(String correo){
		
		try {
			email.setFrom("rogger.123.2@gmail.com");			
			email.setSubject("Recuperacion de contraseña");		
			email.addTo(correo);		
			email.addReplyTo("rogger.123.2@gmail.com");
			JOptionPane.showMessageDialog(null,"5");
			email.send();
			JOptionPane.showMessageDialog(null,"1");
			return true;
		}catch (Exception e) {
			e.printStackTrace();
			System.out.println(e);
			return false;
			
		}
    }
	
	public static void main(String [] args){
		Correo a= new Correo();
		if(a.enviarMail("rogger.123.2@gmail.com")){
			JOptionPane.showMessageDialog(null,"correcto");
		}else{
			JOptionPane.showMessageDialog(null,"no se pudo realizar el envio de correo");
		}
		
	}
*/
}
